<template>
	<view>
		<view style="margin-top: 30upx;">
			<view style="text-align: center;">
				请输入对方账号
			</view>
			<input type="text" v-model="zzopenid" style="border: 1upx solid #000000;height: 90upx;margin: 50upx;padding-left: 20upx;"/>
			<button type="default" @click="yzzh" style="width: 60%;margin-left: 20%;background-color: #EC5C53;color: #fff;">下一步</button>
		</view>
		<view class="">
			<scroll-view scroll-y="true" style="height: 800upx;margin-top: 100upx;">
				<view v-for="(item,index) in hyhzs" :key='index' style="height: 200upx;padding: 30upx 50upx;box-shadow: 2upx 5upx 10upx #ccc;width: 80%;border-radius: 20upx;margin-left: 3%;margin-top: 20upx;">
					<view class="">
						{{item.createtime}}
					</view>
					<view style="text-align: center;margin: 40upx;">
						{{item.remark}}
					</view>
					<view style="text-align: right;">
						{{item.money}}积分
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				openid:'',
				zzopenid:'',
				realname:'',
				credit1:'',
				hyhzs:[],
			}
		},
		onLoad:function(){
			uni.showLoading()
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					this.jumpdata()
				},
				fail: () => {}
			});
			uni.hideLoading()
		},
		onShow:function(){
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					this.jumpdata()
				},
				fail: () => {}
			});
		},
		methods: {
			jumpdata(){
				uni.request({
					url: 'https://app.t9y9y9.com/app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=member.hyhz&app=1',
					method: 'POST',
					data: {'openid':this.openid},
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						console.log(res)
						this.hyhzs = res.data.hyhzs
					},
					fail: () => {},
					complete: () => {}
				});
			},
			yzzh(){
				uni.request({
					url: 'https://app.t9y9y9.com/app/index.php?i=4&c=entry&m=ewei_shopv2&do=mobile&r=member.hyhz.member&app=1',
					method: 'POST',
					data: {
						'openid':this.openid,
						'zzopenid': this.zzopenid,
						},
					header:{'Content-Type':'application/x-www-form-urlencoded'},
					success: res => {
						console.log(res)
						this.credit1 = res.data.credit1
						if(res.data.status == 0){
							uni.showToast({
								title : res.data.result.message,
								icon : 'none',
							})
						}else{
							this.realname = res.data.zzmember.realname
							uni.navigateTo({
								url:'./dozzks?realname='+this.realname+'&zzopenid='+this.zzopenid+'&credit1='+this.credit1
							});
						}
					},
					fail: () => {},
					complete: () => {}
				});
			},
			jump(e){
				uni.navigateTo({
					url: e.currentTarget.dataset.src
				});
			},
		}
	}
</script>

<style>
	page {
		background-color: #fff;
	}
	.btn {padding:20upx 0;}
	.btn button {margin:20upx 0;font-size:28upx;padding:12upx;}
	.btn .logout {border-color:#175e3c;background-image: linear-gradient(to bottom, rgb(243, 109, 31), rgb(252, 9, 9));color: #fff;}
	.uni-list {font-weight: 600;border-radius: 10upx; margin-top: 20upx;}
	.uni-list-cell {height: 100upx;line-height: 100upx;}
	.uni-list-cell.active {background:#f5f5f5;}
	.uni-list image {width:34upx;height:34upx;}
	.uni-list .text {position:absolute;left:44upx;font-size:26upx;top: 0;}
	.uni-list {margin-top:20upx;}
	.uni-list:before,.uni-list:after {display:none;}
	.uni-list-cell:after {content:" ";position:absolute;left:0.5rem;right:0.5rem;bottom:-1px;height:1px;border-top:1px solid #ebebeb;color:#D9D9D9;-webkit-transform-origin:0 0;-ms-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(0.5);-ms-transform:scaleY(0.5);transform:scaleY(0.5);background:none;}
	.uni-list-cell .right {font-size:24upx;color:#999;margin-right:20upx;}
	.uni-list .uni-list-cell:last-child:after {border:0;}
	.uni-list .uni-badge {margin-right:15px;background-color:#f55;}
	.increase_width {width: 95%;margin: 0 auto;}
</style>